# Contributor: David Demelier <markand@malikania.fr>
# Maintainer: David Demelier <markand@malikania.fr>
pkgname="id3lib"
pkgver=3.8.3
pkgrel=0
pkgdesc="library for reading, writing, and manipulating ID3v1 and ID3v2 tags"
url="http://id3lib.sourceforge.net"
arch="all"
license="GPL-2.0-only"
makedepends="autoconf automake libtool zlib-dev"
subpackages="$pkgname-static $pkgname-dev $pkgname-libs"
source="
	http://downloads.sourceforge.net/id3lib/id3lib-$pkgver.tar.gz
	10-fix-compilation-with-cpp-headers.patch
	30-fix-utf16.patch
	50-remove-outdated-check.patch
	60-id3lib-missing-nullpointer-check.patch
	61-fix_vbr_stack_smash.patch
	CVE-2007-4460.patch"
options="!check" # does not build.

prepare() {
	default_prepare
	update_config_guess
	update_config_sub
	libtoolize -fc
	aclocal
	autoconf
	automake --add-missing --copy
}

build() {
	./configure --prefix=/usr
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

static() {
	pkgdesc="Static libraries for id3lib"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/
}

sha512sums="3787e261f86933c1c2f2bff2c4b349b42f5d8636e489e4f39f9d75e6dfbdc79b87009a0f4ce4b786f2fb3dbc01ca9d56c4112095b46244f897e6c9a28573adaf  id3lib-3.8.3.tar.gz
a21024c20abb918081ea87be2114d9dc957cfe5d776e0942d2ef2ae450fa73f36236eaf5d50e1a14e293ca927bb95328da8c65a4ae6af6f43574ace3be0ad260  10-fix-compilation-with-cpp-headers.patch
811e1cc121a965fd0b6162a8937475e3d7dc2a477289707a28f6961ca2b9886b98508a954b12a36c27206202673ebd9ae6ec37d175c947e4e560ac112309ec6d  30-fix-utf16.patch
137732ceee8ec7fc8b686e46bd43276fba6bdcbdce166e85108e7c4b456523b4a29b11ff3101a37489e2386c92dfbe7f088f79c9c054f30515095f2b68c89f48  50-remove-outdated-check.patch
ebb536a3bce83ee8752905766f93c7920d548e85262704d617b3e608a020bca0909f5c59525caa2bbc2f034e2d11fb3eb0842d2b167e00c3ef4551c9eb57adf9  60-id3lib-missing-nullpointer-check.patch
debecda3ace7b8ced35d06f33cee922b5f0c43bcf17b9bc7c859e1910a54d4ddb69930b31104ed66702d5bc011859c6724d3df6ece153cc836a992ff19300d70  61-fix_vbr_stack_smash.patch
d534a1b4ce2fa186c089969c245ffc30c75d3e2b4c67b5a5d4b61fc9a8df04f9b2d5f1e13504b0e2f45540d774d5653c3dfa6e7dee9a12c99e7668a0b35fe8b2  CVE-2007-4460.patch"
